﻿using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Ooganizer.API;
using Ooganizer.Server;

using WorkspaceCollection = System.Collections.ObjectModel.ObservableCollection<Ooganizer.API.Workspace>;

namespace Ooganizer.Client.UI.WorkspaceSelectorLib
{
    /// <summary>
    /// Class which creates mock data for this sample
    /// </summary>
    public class WorkspaceData : INotifyPropertyChanged
    {
        public WorkspaceData()
        {

        }

        public WorkspaceCollection WorkspaceDataCollection
        {            
            get
            {
                WorkspaceCollection wsDS = new WorkspaceCollection();

                using (OoganizerState oogyState = new OoganizerState())
                {
                    using (OoganizerAPIProxy proxy = oogyState.GetAPIProxy())
                    {
                        foreach (Workspace workspace in proxy.API.Workspaces)
                        {
                            wsDS.Add(workspace);
                        }
                    }
                }

                return wsDS;
            }
        }

        //public DataView WorkspaceDataView
        //{
        //    get
        //    {
        //        if (this._dataView == null)
        //            this.PopulateWorkspaceDataView();

        //        return this._dataView;
        //    }
        //}

        #region INotifyPropertyChanged Members

        private void NotifyPropertyChanged(string info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }

}